package com.book.controller;

import com.book.adapter.Login3rdAdapter;
import com.book.pojo.UserInfo;
import com.book.service.UserBridgeService;
import com.book.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @param
 * @author oyz
 * @version 1.0.4
 * @description:TODO
 * @date 2023/10/23 21:56
 */
@RestController
@RequestMapping("/bridge")
public class UserBridgeController {

    @Autowired
    private UserBridgeService userService;




    @PostMapping("/login")
    public String login(String account,String password){
        return userService.login(account,password);
    }

    /**
     * gitee回调接口,并且返回code和state信息
     * @param code
     * @param state
     * @return
     */
    @PostMapping("/gitee")
    public String gitee(HttpServletRequest request){
        return userService.login3Rd(request);
    }

    @PostMapping("/register")
    public String register(@RequestBody UserInfo info){
        return userService.register(info);
    }


}
